angular.module("myApp")
.controller("SearchController", ["$scope","$location","mySearchService","mySearchDetailsService","mySearchDetailsWenService","mySearchDetailsShopService","mySearchDetailsAdminService","mySearchDetailsJinService","mySearchDetailsTieService","$window", function($scope,$location,mySearchService,mySearchDetailsService,mySearchDetailsWenService,mySearchDetailsShopService,mySearchDetailsAdminService,mySearchDetailsJinService,mySearchDetailsTieService,$window){

    $scope.arrList=[];$scope.flag=true;
    $scope.search_jump = function(){
        $location.path("/destination");
    } 
    $scope.search_jump1 = function(){
        $location.path("/search/search_Details");
    }

    function save(){
        $scope.arrList.push({name:$scope.search_bind});
        $window.localStorage.setItem("arrlis",JSON.stringify($scope.arrList)); 
        
    }
    $scope.search_jump2 = function(){ 
      save();      
        $scope.arrList=JSON.parse($window.localStorage.getItem("arrlis"));
    }
    // save();
    if(document.querySelectorAll(".lis").length<1){
        $scope.arrList=JSON.parse($window.localStorage.getItem("arrlis"));
    }
   console.log(document.querySelectorAll(".lis").length);

	mySearchService.getData().success(function(res){
        $scope.items = res;        
    });
    mySearchDetailsService.getData().success(function(data1){
		$scope.arrs = data1.data.entry;
    });
    mySearchDetailsWenService.getData().success(function(data2){
        $scope.items1 = data2.data;
    });
    mySearchDetailsShopService.getData().success(function(data5){
        $scope.items_shop = data5.data.entry;
    });
    mySearchDetailsAdminService.getData().success(function(data4){
        $scope.items3 = data4.data.entry;
    })
    mySearchDetailsJinService.getData().success(function(data7){
        $scope.items_jinData = data7.data.entry;
    });
    mySearchDetailsTieService.getData().success(function(data6){
        $scope.items_tiezi = data6.data.entry;
    });
    
}])